<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>45小人连续奔跑动画</title>
    <style>
        .box {
            position: absolute;
            width: 120px;
            height: 186px;
            background: url(./images/walking2.png) no-repeat;
            /* 多个动画逗号隔开 */
            animation: run 1s steps(8) infinite, move 16s forwards;
        }
        /* 从开始走到中心位置动画 */
        
        @keyframes move {
            0% {
                left: 0;
            }
            100% {
                /* 走到中心位置 */
                left: 50%;
                transform: translateX(-50%);
            }
        }
        /* 原地动起来动画 */
        
        @keyframes run {
            0% {
                background-position: 0;
            }
            100% {
                background-position: -960px;
            }
        }
    </style>
</head>

<body>
    <div class="box">
    </div>
</body>

</html>